package com.example.hyw.szysteam.http;

import com.example.hyw.szysteam.POJO.CLassMember;
import com.example.hyw.szysteam.POJO.ClassItem;
import com.example.hyw.szysteam.POJO.HomeWork;
import com.example.hyw.szysteam.POJO.HttpResult;
import com.example.hyw.szysteam.POJO.HttpReview;
import com.example.hyw.szysteam.POJO.Practice;
import com.example.hyw.szysteam.POJO.Review;
import com.example.hyw.szysteam.POJO.User;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * Created by HYW on 2018/6/4.
 */

public interface ApiService {
    @FormUrlEncoded
    @POST("/registuser")
    Observable<HttpResult<User>> regist(@Field("email") String email, @Field("password") String password);

    @FormUrlEncoded
    @POST("/login")
    Observable<HttpResult<User>> login(@Field("email") String email,@Field("password") String password);

    @FormUrlEncoded
    @POST("/resetpsw")
    Observable<HttpResult<User>> resetpsw(@Field("email") String email,@Field("password") String password);

    @FormUrlEncoded
    @POST("/editinfo")
    Observable<HttpResult<User>> editinfo(@Field("email") String email,@Field("name") String name,@Field("school") String school,@Field("sex") boolean sex,@Field("age") int age);

    @FormUrlEncoded
    @POST("/createclass")
    Observable<HttpResult<String>> createclass(@Field("email") String email,@Field("classname") String classname,@Field("teacher") String teacher);

    @FormUrlEncoded
    @POST("/getclass")
    Observable<HttpResult<ArrayList<ClassItem>>> getclass(@Field("email") String email);

    @FormUrlEncoded
    @POST("/joinclass")
    Observable<HttpResult<String>> joinclass(@Field("email") String email,@Field("classid") String classid);

    @FormUrlEncoded
    @POST("/classmember")
    Observable<HttpResult<ArrayList<CLassMember>>> classmember(@Field("classid") String classid);

    @FormUrlEncoded
    @POST("/createhomework")
    Observable<HttpResult<String>> createhomework(@Field("classid") String classid, @Field("testname") String testname, @Field("date") String date, @Field("practice") String practices);

    @FormUrlEncoded
    @POST("/gethomework")
    Observable<HttpResult<ArrayList<HomeWork>>> gethomework(@Field("classid") String classid);

    @FormUrlEncoded
    @POST("/getpractice")
    Observable<HttpResult<ArrayList<Practice>>> getpractice(@Field("testid") Integer testid);

    @FormUrlEncoded
    @POST("/savemistakebook")
    Observable<HttpResult<Integer>> savemistakebook(@Field("email") String email,@Field("warehouseid") int warehouseid,@Field("myanswer") String answer);

    @FormUrlEncoded
    @POST("/savemistakebooks")
    Observable<HttpResult<Integer>> savemistakebooks(@Field("email") String email,@Field("list") String list,@Field("myanswer") String myanswer);

    @FormUrlEncoded
    @POST("/getmistakebooks")
    Observable<HttpResult<ArrayList<Review>>> getmistakebooks(@Field("email") String email);

    @FormUrlEncoded
    @POST("/setscore")
    Observable<HttpResult<Integer>> setscore(@Field("email") String email,@Field("testid") int testid,@Field("score") int score);

    @FormUrlEncoded
    @POST("/getscore")
    Observable<HttpResult<Integer>> getscore(@Field("email") String email,@Field("testid") int testid);
}
